﻿using System;
using System.Collections.Generic;

using TrueCode.Core.EditableEntity;

namespace Client.BL.Tests
{
  public class Entity : IEntity< Entity >
  {
    private readonly Guid _key;

    public Entity( int id, string name ) : this( Guid.NewGuid(), id, name, 0 ){}
    private Entity( Guid key, int id, string name, int revision )
    {
      _key = key;
      Id = id;
      Name = name;
      Revision = revision;
    }

    public Guid Key
    {
      get { return _key; }
    }

    public int Id { get; set; }

    public string Name { get; set; }

    public int Revision{ get; set; }

    public Entity Copy()
    {
      return new Entity( _key, Id, Name, Revision );
    }

    public class EqualityComparer : IEqualityComparer< Entity >
    {
      public bool Equals( Entity x, Entity y )
      {
        return x.Key == y.Key;
      }

      public int GetHashCode( Entity obj )
      {
        throw new NotImplementedException();
      }
    }
  }
}